<!DOCTYPE html>
<html class="loading" lang="en" data-textdirection="" xmlns:c="http://www.w3.org/1999/XSL/Transform"
      xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>
<script src="../js/jquery.min.js" type="text/javascript"></script>
<script src="../js/func.js?v=1.0" type="text/javascript"></script>
<script src="../js/jquery-ui-1.10.4.min.js" type="text/javascript"></script>
<script src="../js/jquery.serializejson.js" type="text/javascript"></script>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
  <meta name="description" content="Modern admin is super flexible, powerful, clean &amp; modern responsive bootstrap 4 admin template with unlimited possibilities with bitcoin dashboard.">
  <meta name="keywords" content="admin template, modern admin template, dashboard template, flat admin template, responsive admin template, web app, crypto dashboard, bitcoin dashboard">
  <meta name="author" content="PIXINVENT">
  <title>中国网络安全审查与认证区块链平台-注册
</title>
  <link rel="apple-touch-icon" href="../images/ico/apple-icon-120.png">
  <link rel="shortcut icon" type="image/x-icon" href="../images/ico/favicon.ico">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Quicksand:300,400,500,700"
  rel="stylesheet">
  <link href="https://maxcdn.icons8.com/fonts/line-awesome/1.1/css/line-awesome.min.css"
  rel="stylesheet">
  <!-- BEGIN VENDOR CSS-->
  <link rel="stylesheet" type="text/css" href="../css/vendors.css">
  <!-- END VENDOR CSS-->
  <!-- BEGIN MODERN CSS-->
  <link rel="stylesheet" type="text/css" href="../css/app.css">
  <!-- END MODERN CSS-->
  <!-- BEGIN Page Level CSS-->
  <link rel="stylesheet" type="text/css" href="../css/core/menu/menu-types/vertical-menu.css">
  <link rel="stylesheet" type="text/css" href="../css/core/colors/palette-gradient.css">
  <link rel="stylesheet" type="text/css" href="../css/pages/login-register.css">
  <!-- END Page Level CSS-->
  <!-- BEGIN Custom CSS-->
  <link rel="stylesheet" type="text/css" href="../css/style.css">
  <!-- END Custom CSS-->
  
  
<!--<style type="text/css">
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background:none;
    background-clip: border-box;
    border:none;
    border-radius: 0rem;box-shadow:none!important;
}
.line-on-side span{background:#f4f5fa;}
</style>-->
<style type="text/css">
.has-icon-left .form-control.input-lg {padding-right: 1.25rem;padding-left: calc(1.0625rem + 2px);}
select.form-control:not([size]):not([multiple]).input-lg, input.form-control.input-lg{height: 2.8rem;}
</style>
</head>
<body class="vertical-layout vertical-menu 1-column   menu-expanded blank-page blank-page"
data-open="click" data-menu="vertical-menu" data-col="1-column">
  <!-- ////////////////////////////////////////////////////////////////////////////-->
  <div class="app-content content">
    <div class="content-wrapper">
      <div class="content-header row">
      </div>
      <div class="content-body">
        <section class="flexbox-container">
          <div class="col-12 d-flex align-items-center justify-content-center">
            <div class="col-md-4 col-10 p-0">
              <div class="card border-grey border-lighten-3 px-2 py-2 m-0">
                <div class="card-header border-0" style="background:none;">
                  <div class="card-title text-center">
                    <img src="../images/logo/logo-dark.png" alt="branding logo">
                  </div>
                 <h6 class="card-subtitle line-on-side text-muted text-center font-small-3 pt-2" style="width:45%;margin:0 auto 20px auto;">
                    <span class="font-medium-2" style="padding:0 1.3rem; font-family:'microsoft yahei;">修改密码</span>
                  </h6>
                </div>
               <!-- <div class="card-content"> <div class="text-bold-600 font-medium-2">
                        帐户注册
                     </div>-->


                         <!--
                      <select class="hide-search form-control accordion-text form-control form-control-lg input-lg" id="roleType" style="color:#babfc7;padding-left:1.10rem;">
                        <optgroup label=""><option value="">角色类型</option>
                          <option value="1">1-网安中心操作员</option>
                          <option value="2">2-网安中心管理员</option>
                        </optgroup>
                      </select>  </fieldset>
                      -->
                      <script>
						function changeSelect(){
							var obj=document.getElementById("institutionType");
								if(obj[2].selected==true||obj[3].selected==true){
									$("#userType option[value='2']").hide(); 
									//$("#userType option[value='2']").prop("selected", false);
								}
								if(obj[1].selected==true){
									$("#userType option[value='2']").show();
									//$("#userType option[value='2']").prop("selected", true);
								}

							}
						function changeRole(){
							if(Cookies.get("loginname")=="Admin"){
									$("#userType option[value='1']").hide();
									$("#institutionType option[value='2']").hide();
									$("#institutionType option[value='3']").hide();
									
								}	
								if(Cookies.get("loginname")!="Admin"){
									$("#userType option[value='1']").show();
									$("#institutionType option[value='2']").show();
									$("#institutionType option[value='3']").show();
								}
						}
					  </script>
                      
                      <fieldset class="form-group position-relative has-icon-left mb-1">
                        <input type="password" class="form-control form-control-lg input-lg" id="passwd"
                        placeholder="请输入原密码" required>
                      
                      </fieldset>

                <fieldset class="form-group position-relative has-icon-left mb-1">
                  <input type="password" class="form-control form-control-lg input-lg" id="passwd1"
                         placeholder="请输入新密码" required>

                </fieldset>
                      
                      <button onclick="register()" class="btn btn-info btn-lg btn-block">点击修改</button>
                    <!-- </form> -->
					
					<script language="JavaScript">

                      $("#institutionNumber").change(function(){
                        var da = $("#institutionNumber").val();
                        console.log(da)
                        $.ajax({
                          dataType:"json",
                          type:"post",
                          crossDomain: true, //new add
                          contentType: 'application/x-www-form-urlencoded',
                          url:"/getinsName",
                          beforeSend: function(xhr) {
                          },
                          data:{"institutionNumber":da},
                          success: function (result) {
                            if(result.code==0)
                            {
                              $("#institutionName").val(result.msg)
                              $("#institutionName").attr("disabled","disabled");
                            }else{
                              alert(result.msg)
                              $("#institutionName").val("");
                              $("#institutionName").removeAttr("disabled");
                            }
                          },
                          error: function (jqXHR, textStatus, errorThrown) {
                          }
                        });

                      });




                      var adminList={};
                      $.ajax({
                        dataType:"json",
                        type:"post",
                        crossDomain: true, //new add
                        contentType: 'application/json',
                        url:"/getadmin",
                        beforeSend: function(xhr) {
                        },
                        data: [],
                        success: function (result) {
                          adminList=result;
                        },
                        error: function (jqXHR, textStatus, errorThrown) {
                        }
                      });


                      $("#name").change(function(){
                        // var list ='<%=session.getAttribute("admin")%>'
                        // var lists = "${admin}"
                        // var s="<%=session.getAttribute("admin")%>"
                        // //console.log(list);
                        console.log(adminList);
                        var t = false;
                        var tx = $("#name").val()

                        for(var i = 0;i<adminList.length;i++)
                        {
                          if(tx == adminList[i].username)
                            t=true;
                        }
                        if(t){
                          $("#usertypes").append("<option id=\"adms\" value=\"3\">3-管理员</option>")
                        }else{
                          $("#adms").remove()
                        }
                      });

					var token=Cookies.get('token');
						console.log(token);
						function register(){

                          var passwd1=document.getElementById("passwd1").value;
                          var passwd=document.getElementById("passwd").value;
						if(passwd1=""||passwd==""){
							alert("不能有数据为空");
                          if(passwd!=""){
                            document.getElementById('passwd').style.border = '#BABFC7 1px solid';
                          }
                          if(passwd1!=""){
                            document.getElementById('passwd1').style.border = '#BABFC7 1px solid';
                          }
							//window.location.href="register-simple.html";
						}

						else
						{
                          var passwd1=document.getElementById("passwd1").value;
                          var passwd=document.getElementById("passwd").value;
                          console.log(passwd)
                          console.log(passwd1)
						//var data1 = 'test';
						$.ajax({
							dataType:"json",
							type:"post",
							crossDomain: true, //new add
							contentType: 'application/x-www-form-urlencoded',
							url:"updatePassword",
							beforeSend: function(xhr) { 
								xhr.setRequestHeader("Authorization", "Bearer "+token);
							},
							data: {"password":passwd,"newpassword":passwd1},
							success: function (result) {
							  console.log(result)



									// var transaction=result.message.split(":")[1].replace(/^\s+|\s+$/g,"");
									// alert("您的txid为："+transaction+",请妥善保管");
									//Cookies.set("transaction",transaction);
                              if(result.code==0) {
                                my_confirm(result.msg,function(){window.location = "login"})

                              }else{
                                my_confirm(result.msg,function(){window.location.reload()})
                              }
							},
							error: function (jqXHR, textStatus, errorThrown) {
								/*弹出jqXHR对象的信息*/
								alert(jqXHR.responseText);
								alert(jqXHR.status);
								alert(jqXHR.readyState);
								alert(jqXHR.statusText);
								/*弹出其他两个参数的信息*/
								alert(textStatus);
								alert(errorThrown);
							}
						});
    }
						}
					</script>
                  </div>
                  <!-- <p class="text-center">已经注册过了? <a href="login-simple.html" class="card-link">使用已有帐户登录</a></p> -->
                </div>
              </div>
            </div>
          </div>
        </section>
      </div>
    </div>
  </div>
  <!-- ////////////////////////////////////////////////////////////////////////////-->
  <!-- BEGIN VENDOR JS-->
  <script src="../vendors/js/vendors.min.js" type="text/javascript"></script>
  <!-- BEGIN VENDOR JS-->
  <!-- BEGIN PAGE VENDOR JS-->
  <script src="../vendors/js/forms/validation/jqBootstrapValidation.js"
  type="text/javascript"></script>
  <!-- END PAGE VENDOR JS-->
  <!-- BEGIN MODERN JS-->
  <script src="../js/core/app-menu.js" type="text/javascript"></script>
  <script src="../js/core/app.js" type="text/javascript"></script>
  <!-- END MODERN JS-->
  <!-- BEGIN PAGE LEVEL JS-->
  <script src="../js/scripts/forms/form-login-register.js" type="text/javascript"></script>
  <!-- END PAGE LEVEL JS-->
</body>
</html>